package com.thf.task;

import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;

@Component
public class TimeTask {

    @Resource
    private RabbitTemplate rabbitTemplate;

    @Scheduled(cron = "0 */30 * ? * ?")
    public void timer(){
        rabbitTemplate.convertAndSend("thfTopicExchange","task.test","定时任务----------执行");
        System.out.println("定时任务----------执行");
    }
}
